<{capture name="header"}>
  <link href="../apps/ome/statics/ome.css" rel="stylesheet" type="text/css">
<{/capture}>
<h4 class="head-title">前端店铺</h4>
<div class="tableform">
           <div class="division">
<form method="post" action="index.php?app=ome&ctl=admin_shop&act=saveterminal" id="terminal">
      <input type="hidden" name="shop[shop_id]" value="<{$shop.shop_id}>" />
      <table width="100%" cellspacing="0" cellpadding="0" border="0" >
        <tbody>
       <tr>
          <th><em class="c-red">*</em> 店铺编码：</th>
          <td><{if $shop.shop_bn}><{$shop.shop_bn}><{else}><{input type='text&&required' name="shop[shop_bn]" value=$shop.shop_bn}><{/if}>
          <input type='hidden' name="shop[old_shop_bn]" value="<{$shop.shop_bn}>">
          <{help}><{t}>前端网店在系统中的唯一标识<{/t}><{/help}>
          </td>
        </tr>
        <tr>
        <th ><em class="c-red">*</em> 名称：</th>
          <td><{input type="text&&required" size="32" name="shop[name]" value=$shop.name}>
          <{help}><{t}>前端网店在此系统需要显示的中文名称<{/t}><{/help}>
          </td>
        </tr>
		<tr>
          <th><em class="c-red">*</em> 地区：</th>
          <td><{input type='region' app='eccommon' name="shop[area]" value=$shop.area vtype="area" }>
          <{help}><{t}>用来联系及打印在“快递单”中发货点所在省/市/县（区）<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th><em class="c-red">*</em> 地址：</th>
          <td><input type="text" vtype="required" name="shop[addr]" size="50" value="<{$shop.addr}>"/>
          <{help}><{t}>用来联系及打印在“快递单”中发货点的发货地址<{/t}><{/help}>

          </td>
        </tr>
		<tr>
          <th><em class="c-red">*</em> 邮编：</th>
          <td><input type="text" vtype="required" id="zip" name="shop[zip]" size="6" maxlength="6" value="<{$shop.zip}>"/>
          <{help}><{t}>用来联系及打印在“快递单”中发货点所在地区的邮政编号<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th><em class="c-red">*</em> 发件人：</th>
          <td><input type="text" vtype="required" name="shop[default_sender]" size="12" value="<{$shop.default_sender}>"/>
          <{help}><{t}>用来联系及打印在“快递单”中发货点负责人的姓名<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>固定电话：</th>
          <td><input type="text" id="shop[tel]" name="shop[tel]" size="20" value="<{$shop.tel}>"/>
          <{help}><{t}>用来联系及打印在“快递单”中发货点的固定电话，卖家固定电话格式为：区号+电话+分机号(没有可不填)，中间用"-"隔开; 卖家固定电话和卖家手机号码,必须填写一个. <{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>手机：</th>
          <td><input type="text" id="mobile" name="shop[mobile]" size="15" value="<{$shop.mobile}>"/>
          <{help}><{t}>用来联系及打印在“快递单”中发货点的移动联系方式；号码前请不要加0<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>AX客户编码：</th>
          <td><input type="text" id="AXCustomer" name="shop[AXCustomer]" size="15" value="<{$shop.AXCustomer}>"/>
          <{help}><{t}>AX客户编码，一个客户多个店铺的情况<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th><em class="c-red">*</em>AX退货客户编码：</th>
          <td><input type="text" id="Re_AXCustomer" name="shop[Re_AXCustomer]" size="15" value="<{$shop.Re_AXCustomer}>"/>
          <{help}><{t}>AX退货客户编码，指定该店铺退货AX生成退货单客户<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>客户简称：</th>
          <td><input type="text" id="shortname" name="shop[shortname]" size="15" value="<{$shop.shortname}>"/>
          <{help}><{t}>客户简称<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>客户名称：</th>
          <td><input type="text" id="customername" name="shop[customername]" size="15" value="<{$shop.customername}>"/>
          <{help}><{t}>客户名称<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>客户中文简称：</th>
          <td><input type="text" id="customerchnname" name="shop[customerchnname]" size="15" value="<{$shop.customerchnname}>"/>
          <{help}><{t}>客户中文简称：<{/t}><{/help}>
          </td>
        </tr>

        <tr>
          <th>跟单员：</th>
          <td><input type="text" id="operator" name="shop[operator]" size="15" value="<{$shop.operator}>"/>
          <{help}><{t}>跟单员<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>销售经理：</th>
          <td><input type="text" id="soprojecter" name="shop[soprojecter]" size="15" value="<{$shop.soprojecter}>"/>
          <{help}><{t}>销售经理<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>送货地址：</th>
          <td><input type="text" id="shipaddress" name="shop[shipaddress]" size="15" value="<{$shop.shipaddress}>"/>
          <{help}><{t}>送货地址<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>结算方式：</th>
          <td><input type="text" id="accountmethod" name="shop[accountmethod]" size="15" value="<{$shop.accountmethod}>"/>
          <{help}><{t}>结算方式<{/t}><{/help}>
          </td>
        </tr>

        <tr>
          <th>客户结算方式<{$shop.JSType}></th>
          <td>
                <input type="radio" id="JSType" name="shop[JSType]" value='0'  <{if $shop.JSType == '0'}>checked="checked"<{/if}> />代收代付
                <input type="radio" id="JSType" name="shop[JSType]" value='1' <{if $shop.JSType == '1'}>checked="checked"<{/if}> />理文支付
                <input type="radio" id="JSType" name="shop[JSType]" value='2' <{if $shop.JSType == '2'}>checked="checked"<{/if}> />客户支付
                <input type="radio" id="JSType" name="shop[JSType]" value='3' <{if $shop.JSType == '3'}>checked="checked"<{/if}> />无
          <{help}><{t}>客户结算方式<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>理文店铺类型<{$shop.leemantype}></th>
          <td>
              <input type="radio" id="leemantype" name="shop[leemantype]" value='0'  <{if $shop.leemantype == '0'}>checked="checked"<{/if}> />无
              <input type="radio" id="leemantype" name="shop[leemantype]" value='1' <{if $shop.leemantype == '1'}>checked="checked"<{/if}> />自运营
              <input type="radio" id="leemantype" name="shop[leemantype]" value='2' <{if $shop.leemantype == '2'}>checked="checked"<{/if}> />代运营
              <input type="radio" id="leemantype" name="shop[leemantype]" value='3' <{if $shop.leemantype == '3'}>checked="checked"<{/if}> />经销商
          <{help}><{t}>理文店铺类型<{/t}><{/help}>
          </td>
        </tr>
        
        <tr>
          <th>联系人：</th>
          <td><input type="text" id="contact" name="shop[contact]" size="15" value="<{$shop.contact}>"/>
          <{help}><{t}>联系人<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th>联系电话：</th>
          <td><input type="text" id="contacttel" name="shop[contacttel]" size="15" value="<{$shop.contacttel}>"/>
          <{help}><{t}>联系电话<{/t}><{/help}>
          </td>
        </tr>
        <tr>
          <th> 网店地址：</th>
          <td><{input type="text" size="60" name="shop[config][url]" value=$shop_config.url}>
         <{help}><{t}>前端网店在第三方平台的唯一标识（店铺的链接地址）<{/t}><{/help}>
          </td>
        </tr>
        <tr class="x-ex" style="display:none">
          <th><em class="c-red">*</em> 账号：</th>
          <td><{input type="text&&required" name="shop[config][account]" size="32" value=$shop_config.account}>
          <{help}><{t}>登陆前端网店的账号，系统用来与前端网店数据同步使用<{/t}><{/help}>

          </td>
        </tr>
        <tr class="x-ex" style="display:none">
          <th><em class="c-red">*</em> 密码：</th>
          <td><{input type="password" name="shop[config][password]" size="20" value=$shop_config.password required="true"}>
            <{help}><{t}> 登陆前端网店的密码，系统用来与前端网店数据同步使用<{/t}><{/help}>

          </td>
        </tr>
         <tr>
           <th>是否回传物流信息：</th>
           <td>
                <input type="radio" name="shop[isWD]" value='true' <{if $shop.isWD == 'true'}>checked<{/if}> />是
                <input type="radio" name="shop[isWD]" value='false' <{if $shop.isWD == 'false'}>checked<{/if}> />否
           </td>
        </tr>
         <tr>
           <th>是否过数AX：</th>
           <td>
                <input type="radio" name="shop[is_sendAX]" value='true' checked="checked" <{if $shop.is_sendAX == 'true'}>checked<{/if}> />是
                <input type="radio" name="shop[is_sendAX]" value='false' <{if $shop.is_sendAX == 'false'}>checked<{/if}> />否
           </td>
        </tr>
         <tr>
           <th>是否回传物流到前端：</th>
           <td>
                <input type="radio" name="shop[is_sendshop]" value='true' <{if $shop.is_sendshop == 'true'}>checked<{/if}> />是
                <input type="radio" name="shop[is_sendshop]" value='false' <{if $shop.is_sendshop == 'false'}>checked<{/if}> />否
           </td>
        </tr>
         <tr>
           <th>店铺发货属性：</th>
           <td>
                <input type="radio" name="shop[sendType]" value='1' checked="checked" <{if $shop.sendType == '1'}>checked<{/if}> />整车发货
                <input type="radio" name="shop[sendType]" value='2' <{if $shop.sendType == '2'}>checked<{/if}> />按天发货
           </td>
        </tr>
         <tr>
           <th>客户类型：</th>
           <td>
                <input type="radio" name="shop[customType]" value='1' checked="checked" <{if $shop.customType == '1'}>checked<{/if}> />电商
                <input type="radio" name="shop[customType]" value='2' <{if $shop.customType == '2'}>checked<{/if}> />OEM
                <input type="radio" name="shop[customType]" value='3' <{if $shop.customType == '3'}>checked<{/if}> />园区代发
           </td>
        </tr>
         <tr>
           <th>店铺状态：</th>
           <td>
                <input type="radio" name="shop[shopstatus]" value='1' checked="checked" <{if $shop.shopstatus == '1'}>checked<{/if}> />启用
                <input type="radio" name="shop[shopstatus]" value='2' <{if $shop.shopstatus == '2'}>checked<{/if}> />禁用
           </td>
        </tr>
        </tbody>
      </table>
<{if $shop.shop_id}>
 <input type="hidden" name="shop[shop_id]" value="<{$shop.shop_id}>">
<{/if}>
<{if $shop.node_id}>
 <input type="hidden" name="shop[node_id]" value="<{$shop.node_id}>">
<{/if}>
<div class="table-action">
<{button class="btn-primary" type="button" id="saveterminal" name="submit" label="提交"}>
</div>
</form>
  </div>
    </div>

<script>

function is_phone(str){

	var partten = /^\d{1,4}-\d{7,8}(-\d{1,6})?$/;
    var partten1 = /^400\d{7}$/;
    if(partten.test(str) || partten1.test(str)){
		return true;
	}else{
		return false;
	}
}

function is_mobile(str){

	var partten = /^\d{8,15}$/;
	if(partten.test(str)){
		return true;
	}else{
		return false;
	}
}

$('saveterminal').addEvent('click',function(event){
	if ($('zip').value.length != "6"){
		   alert('请输入正确的邮编');
		   $('zip').focus();
		   return false;
    }
    //固定电话与手机必填一项
    var gd_tel,mobile;
    gd_tel = $('shop[tel]').value.replace(" ","");
    mobile = $('mobile').value.replace(' ','');
    if (!gd_tel && !mobile){
		   alert('固定电话与手机号码必需填写一项');
		   $('shop[tel]').focus();
		   return false;
    }
    if (gd_tel){
			if (is_phone(gd_tel) === false){
				alert('请填写正确的固定电话');
			    $('shop[tel]').focus();
			    return false;
			}
    }
    if (mobile){
		   if ( is_mobile(mobile) === false){
			    alert('请输入正确的手机号码');
			    $('mobile').focus();
			    return false;
		   }
		   if (mobile[0] == '0'){
			    alert('手机号码前请不要加0');
			    $('mobile').focus();
			    return false;
		   }
    }
    $('terminal').fireEvent('submit',new Event(event));
});

$('terminal').store('target',{
    onRequest:function(){
       $('saveterminal').set('disabled', 'true');
    },
    onComplete:function(jsontext){
       var json = Json.evaluate(jsontext);
       if (typeof(json.error) != 'undefined'){
           $('saveterminal').set('disabled', '');
       }else{
           $('saveterminal').set('disabled', 'true');
           opener.finderGroup['<{$env.get.finder_id}>'].refresh.delay(400,opener.finderGroup['<{$env.get.finder_id}>']);
           window.close();
       }
    }
    });

</script>